<template>
 <div ref="target">
    <HomePanel title="人气推荐" subTitle="人气爆款 不容错过">
    <template #right><XtxMore path="/" /></template>
    <ul ref="pannel" class="goods-list">
      <li v-for="item in goods" :key="item.id">
        <RouterLink :to="'/goods/'+item.id">
          <img v-imgLazy="item.picture" alt="">
          <p class="name">{{item.title}}</p>
          <p class="desc">{{item.alt}}</p>
        </RouterLink>
      </li>
    </ul>
  </HomePanel>
 </div>
</template>
<script>
import { ref } from 'vue'
import { HomeHotApi } from '@/api/home.js'
import HomePanel from './HomePanle.vue'
import { useInter } from '@/composition/index.js'
export default {
  name: 'HomeHot',
  components: { HomePanel },
  setup  () {
    const goods = ref([])
    const fn = () => {
      HomeHotApi().then(res => {
        goods.value = res.result
      })
    }
    const target = useInter(fn)
    return { goods, target }
  }
}
</script>
<style scoped lang='less'>
.goods-list {
  display: flex;
  justify-content: space-between;
  height: 426px;
  li {
    width: 306px;
    height: 406px;
    .hoverShadow();
    img {
      width: 306px;
      height: 306px;
    }
    p {
      font-size: 22px;
      padding-top: 12px;
      text-align: center;
    }
    .desc {
      color: #999;
      font-size: 18px;
    }
  }
}
</style>
